<!DOCTYPE html>
<html lang="en">
<#include "common/head.html">

<body class="fix-header fix-sidebar">

<!-- Preloader - style you can find in spinners.css -->
<div class="preloader">
    <svg class="circular" viewBox="25 25 50 50">
        <circle class="path" cx="50" cy="50" r="20" fill="none"
                stroke-width="2" stroke-miterlimit="10"/>
    </svg>
</div>
<!-- Main wrapper  -->
<div id="main-wrapper">
    <!-- header header  -->
    <#include "common/header.html">
    <!-- End header header -->
    <!-- Left Sidebar  -->
    <#include "common/nav.html">
    <!-- End Left Sidebar  -->
    <!-- Page wrapper  -->
    <div class="page-wrapper">
        <!-- 锐高软件 -->
        <#include "/common/ruigao.html">

        <!--
                    作者：offline
                    时间：2018-03-26
                    描述：部门查看信息
                -->
        <div class="container-fluid">
            <!-- Start Page Content -->
            <div class="row justify-content-center">
                <div class="col-12">
                    <div class="card">
                        <div class="card-body">
                            <div class="card-content">
                                <!-- Left sidebar -->
                                <div class="inbox-leftbar">
                                    <a class="btn btn-danger btn-block waves-effect waves-light"
                                       href="dept_add.html"> <font
                                            style="vertical-align: inherit;"> <font
                                            style="vertical-align: inherit;">添加部门</font>
                                    </font>
                                    </a>

                                </div>

                            </div>
                            <!-- End Left sidebar -->

                            <div>

                                <div role="toolbar">
                                    <div class="btn-group">
                                        <button class="btn btn-light waves-effect" type="button">
                                            <i class="mdi mdi-archive font-18 vertical-middle"></i>
                                        </button>
                                        <button class="btn btn-light waves-effect" type="button">
                                            <i class="mdi mdi-alert-octagon font-18 vertical-middle"></i>
                                        </button>
                                        <button class="btn btn-light waves-effect" type="button">
                                            <i class="mdi mdi-delete-variant font-18 vertical-middle"></i>
                                        </button>
                                    </div>
                                    <div class="btn-group show">
                                        <button aria-expanded="false" data-toggle="dropdown"
                                                class="btn btn-light dropdown-toggle waves-effect"
                                                type="button">
                                            公司
                                        </button>
                                        <div class="dropdown-menu">
                                            <a href="" class="dropdown-item"></a>

                                        </div>
                                    </div>

                                </div>

                                <div class="mt-4">
                                    <br/>
                                    <table class="table">
                                        <thead>
                                        <tr>
                                            <th>用户名称</th>
                                            <th>电话号码</th>
                                            <th>注册时间</th>
                                            <th>积分</th>
                                            <th>操作</th>
                                        </tr>
                                        </thead>
                                        <tbody class="information">
                                        <#list page.pageList as item>
                                        <tr>
                                            <#if (page.pageList)??>
                                            <#if (item.userName)??>
                                            <td name="userName">${item.userName }</td>
                                            <#else>
                                            <td>暂无</td>
                                        </
                                        #if>
                                        <#if (item.userPhone)??>
                                        <td name="userPhone">
                                            <a>${item.userPhone }</a>
                                        </td>
                                        <#else>
                                        <td>暂无</td>
                                        </
                                        #if>
                                        <#if (item.userDate)??>
                                        <td name="userDate">${item.userDate?date }</td>
                                        <#else>
                                        <td>暂无</td>
                                    </
                                    #if>
                                    <#if (item.userCoin)??>
                                    <td name="userCoin">${item.userCoin }</td>
                                    <#else>
                                    <td>暂无</td>
                                </
                                #if>
                                <#if (item.userId)??>
                                <input type="hidden" class="userid" name="userId" value="${item.userId }" id="userId">
                            </
                            #if>
                            <td>
                                <button type="button"
                                        class="btn btn-success btn-sm btn-rounded m-b-2 m-l-5">
                                    <a href="toupdateuser?userId=${item.userId }" style="color: white;">编辑</a>

                                </button>
                                <button id="del" onclick="del()" type="button" data-userId="${item.userId }"
                                        class="btn btn-danger btn-sm btn-rounded m-b-2 m-l-5 " name="dels">
                                    删除
                                </button>
                            </td>
                        </
                        #if>
                        </tr>
                    </
                    #list>
                    </tbody>
                    </table>
                </div>


                <div class="table-responsive m-t-40">
                    <div id="example23_wrapper" class="dataTables_wrapper">
                        <div class="dataTables_paginate paging_simple_numbers"
                             id="example23_paginate">

                            <a href="douserlist?form=1" class="paginate_button previous disabled"
                               aria-controls="example23" data-dt-idx="0" tabindex="0"
                               id="example23_previous"><font
                                    style="vertical-align: inherit;"><font
                                    style="vertical-align: inherit;">首页</font></font></a>

                            <#if page.getHasPrevPage() == true>
                            <a href="douserlist?form=${page.prevPage}" class="paginate_button previous disabled"
                               aria-controls="example23" data-dt-idx="0" tabindex="0"
                               id="example23_previous"><font
                                    style="vertical-align: inherit;"><font
                                    style="vertical-align: inherit;">上一页</font></font></a>
                        </
                        #if>

                        <#if page.getHasNextPage() == true>
                        <a href="douserlist?form=${page.nextPage}"
                           class="paginate_button next" aria-controls="example23"
                           data-dt-idx="7" tabindex="0" id="example23_next"><font
                                style="vertical-align: inherit;"><font
                                style="vertical-align: inherit;">下一页</font></font></a>
                    </
                    #if>

                    <a href="douserlist?form=${page.totalPage}" class="paginate_button previous disabled"
                       aria-controls="example23" data-dt-idx="0" tabindex="0"
                       id="example23_previous"><font
                            style="vertical-align: inherit;"><font
                            style="vertical-align: inherit;">末页</font></font></a>

                </div>
            </div>
        </div>
    </div>

</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- End Container fluid  -->
<!-- footer -->
<#include "common/footer.html">
<!-- End footer -->
<!-- End Page wrapper  -->
<#include "common/js.html">
<!--
        作者：offline
        时间：2018-04-09
        描述：点击删除按钮弹窗
    -->

<script type="text/javascript">
    function del() {
        var id = $(".userid").val();
        swal({
                title: "您确定要删除该分类吗？",
                animation: "slide-from-top",
                showCancelButton: true,
                closeOnConfirm: false,
                cancelButtonText: "取消",
                confirmButtonText: "确定"
            },
            function (inputValue) {
                if (inputValue == false) {
                    return false;
                } else {
                    $.ajax({
                        url: "deluser",
                        type: "GET",
                        data: {"userId": id},
                        datatype: "JSON",
                        success: function (data) {
                            if (data) {
                                swal({
                                    title: "删除成功,<span style='color:red'>已删除</span>该分类",
                                    html: true,
                                    type: "success",
                                    showCancelButton: false,
                                    showConfirmButton: true,
                                    confirmButtonText: "确定",
                                }, function () {
                                    location.reload();
                                });
                            } else {

                            }
                        },
                        error: function (data) {
                            swal({
                                title: '删除失败！',
                                type: 'error',
                                confirmButtonText: '确定',
                                closeOnConfirm: false
                            });
                        }
                    });
                }
            });
    }
</script>

</body>

</html>